home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2126 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.0 KB

  1. Path: access4.digex.net!not-for-mail
  2. From: ell@access4.digex.net (Ell)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Destructors in functions
  5. Date: 16 Jan 1996 03:23:07 GMT
  6. Organization: The Universe
  7. Message-ID: <4df5mr$q92@news4.digex.net>
  8. References: <4d7r65$dv9@newsbf02.news.aol.com> <4de8pf$apt@nntpd2.cxo.dec.com>
  9. NNTP-Posting-Host: access4.digex.net
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. Brian Hibbert (b_hibbert@csc32.enet.dec.com) wrote:
  13. : weatby@aol.com (Weatby) wrote:
  14. : >If you pass an object to a function, the language makes a bitwise copy of
  15. : >it, local to the function.  (Assuming no copy constructor is defined.) 
  16. : >Then, on the way out, the function calls the user-defined constructor.
  17. : >
  18. : As others have pointed out, the compiler should do a memberwise copy of 
  19. : the object.  You can avoid much of this by passing a reference to the 
  20. : object (which should not call a copy constructor).
  21.  
  22. Though any class object, being assigned the reference, which has a copy
  23. ctor that has an argument of the reference type will have that ctor
  24. called. 
  25.  
  26. Elliott
  27.